﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace WinnerCMS.Data.Mapping
{
    public partial class UdtMap
        : EntityTypeConfiguration<WinnerCMS.Model.UDT>
    {
        public UdtMap()
        {
            // table
            //ToTable("CMS_UDT");

            // keys
            HasKey(t => new { t.Id, t.Name });

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.Name)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.DataSource)
                
                .HasMaxLength(1000)
                .IsOptional();
            Property(t => t.SqlScript)
                
                .HasMaxLength(1000)
                .IsOptional();
            Property(t => t.Type)
                
                .IsRequired();
            Property(t => t.JsPath)
                
                .HasMaxLength(255)
                .IsOptional();
            Property(t => t.Stop)
                
                .IsRequired();
            Property(t => t.URLType)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.FirstItemTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.SecondItemTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.AlternatingItemTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.SeparatorTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.ItemTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.HeaderTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.FooterTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.EmptyDataTemplate)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.Tag)
                
                .HasMaxLength(4000)
                .IsOptional();
            Property(t => t.Remark)
                
                .HasMaxLength(500)
                .IsOptional();
            Property(t => t.CheckInTime)
                
                .IsRequired();

            // Relationships

            //InitializeMapping();
        }
    }
}

